<?php
$this->load->view('header');
echo $link;
?>

<h1>Simple Events Demos</h1>

<hr />

<script type="text/javascript">
 $(document).ready(function() {
	<?=$this->pquery->observe_field('#linkclick',array('event'=>'click','function'=>'alert(\'Someone Clicked me\')'));?> 
	<?=$this->pquery->observe_field('#inputchange',array('event'=>'change','function'=>'alert(\'Ive got Changed\')'));?> 
  });
</script>

<p><strong>observe_field</strong> - simple observe field.</p>
<a id="linkclick" href="#">Im being observed for clicks<a><br /><br />
<input type="text" name="name" id="inputchange" value=""/>

<hr />
<p><strong>observe_field</strong> - Ajax validation.</p>


<script type="text/javascript">
 $(document).ready(function() {
	<?=$this->pquery->observe_field('#inputemail',array('event'=>'keyup','function'=>$this->pquery->remote_function(array('url'=>$controller_url.'validate/','update'=>'#ajaxvalidate','with'=>'email="+$("#inputemail").val()+"','type'=>'POST'))));?> 
  });
</script>

Email : <input type="text" name="name" id="inputemail" value=""/> (<b><span id='ajaxvalidate'><font color="RED">Invalid</font></span></b>)

<?php
$this->load->view('footer');
?>